package org.homly.admin.action.scheme;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.homly.service.SchemeService;

public class SetSchemeTopAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		Integer schemeId = null;

		String schemeIdS = request.getParameter("id");
		if (schemeIdS == null || "".equals(schemeIdS)) {
			schemeIdS = "0";
		}
		schemeId = Integer.valueOf(schemeIdS);

		if (schemeId != null && schemeId.intValue() != 0) {
			SchemeService.setSchemeTop(schemeId);
		}

		return new ActionForward(mapping.findForward("manager_scheme").getPath(), true);
	}

}
